<?php

use common\helpers\Url;
use common\helpers\Html;
use yii\grid\GridView;

$this->title = '待结算';
$this->params['breadcrumbs'][] = ['label' => $this->title];
?>

<div class="row">
    <div class="col-sm-12">
        <div class="nav-tabs-custom">
            <ul class="nav nav-tabs">
                <li><a href="<?= Url::to(['settle-account/index']) ?>"> 结算记录</a></li>
                <li class="active"><a href="<?= Url::to(['settle-account-records/index']) ?>"> 待结算</a></li>
            </ul>
            <div class="tab-content">
                <div class="active tab-pane">
                    <p>企业收入金额 = 实付金额 - 退款金额 - 平台抽成 - 分销佣金</p>
                    <?= GridView::widget([
                        'dataProvider' => $dataProvider,
                        'filterModel' => $searchModel,
                        //重新定义分页样式
                        'tableOptions' => [
                            'class' => 'table table-hover rf-table',
                            'fixedNumber' => 3,
                            'fixedRightNumber' => 1,
                        ],
                        'columns' => [
                            [
                                'class' => 'yii\grid\SerialColumn',
                            ],
                            'order_sn',
                            [
                                'label' => '实付金额',
                                'attribute' => 'product_pay_money',
                            ],
                            [
                                'attribute' => 'refund_money',
                                'format' => 'raw',
                                'value' => function ($model) {
                                    return Html::tag('span', $model->refund_money, [
                                        'class' => 'red'
                                    ]);
                                },
                            ],
                            [
                                'label' => '平台抽成',
                                'attribute' => 'platform_money',
                                'format' => 'raw',
                                'value' => function ($model) {
                                    return Html::tag('span', $model->platform_money, [
                                        'class' => 'red'
                                    ]);
                                },
                            ],
                            [
                                'label' => '分销佣金',
                                'attribute' => 'merchant_distribution_money',
                                'format' => 'raw',
                                'value' => function ($model) {
                                    return Html::tag('span', $model->merchant_distribution_money, [
                                        'class' => 'red'
                                    ]);
                                },
                            ],
                            [
                                'attribute' => 'merchant_money',
                                'format' => 'raw',
                                'value' => function ($model) {
                                    return Html::tag('span', $model->merchant_money, [
                                        'class' => 'green'
                                    ]);
                                },
                            ],
                            [
                                'label' => '备注',
                                'attribute' => 'remark',
                                'format' => 'raw',
                                'value' => function ($model) {
                                    return Html::textNewLine($model->remark);
                                },
                            ],
                            [
                                'attribute' => 'created_at',
                                'filter' => false, //不显示搜索框
                                'format' => ['date', 'php:Y-m-d H:i:s'],
                            ],
                        ],
                    ]); ?>
                </div>
            </div>
        </div>
    </div>
</div>